Dynamic Segments can be extended to catch-all subsequent segments by adding an ellipsis inside the brackets [...folderName]. For example, app/shop/[...slug]/page.js will match /shop/clothes, but also /shop/clothes/tops, /shop/clothes/tops/t-shirts, and so on.
They are useful wherever we want to handle different url with same logic
They are useful for nested routes, wildcard routes, and flexible URL structures.
Use optional catch-all segments ([[...slug]]) to match both the root and nested paths.